package solutions;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-01-27
 * Time: 13:30
 */

//https://leetcode.cn/problems/build-an-array-with-stack-operations/submissions/397316177/
class Solution {
    public List<String> buildArray(int[] target, int n) {
        List<String> res = new ArrayList<>();
        int prev = 0;
        for (int num : target) {
            for (int i = 0; i < num - prev - 1; i++) {
                res.add("Push");
                res.add("Pop");
            }
            prev = num;
            res.add("Push");
        }
        return res;
    }
}
